package com.baturu.vin.benz.dal.dao;

import com.baturu.vin.benz.dto.BenzEPCPartsInfoDTO;
import com.baturu.vin.benz.dto.BenzImageDTO;
import com.baturu.vin.benz.dto.BenzImagePartDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * 奔驰图组信息
 * @author jiangxinlei
 * @Time 2018/1/5.
 */
public interface BenzImagePartDAO {

    @Select({"<script>select distinct sortName, imageCode from benz_sort_image_mapping",
            "where sortName in ",
            "<foreach item='item' index='index' collection='sortName' open='(' separator=',' close=')' >",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<BenzImagePartDTO> queryImageBySortName(@Param("sortName") Collection<String> sortName);

    @Select({"<script>select id,catnum,groupnum,subgrp subGroup,seqnum,seqno,callout,replflg replFlag,parttype partsType,partnum,nounidx partsNameIdx,",
            "descidx,indent,tuvsign,optflag,optPart,steering,type,reptype,reppno,footnotes,neutral,codeb saCode,",
            "quantbm,components,submods,reppart,POS_ADDR posAddr,cbPartsCode from bm_parts2_v   " ,
            "where callout is not null and (catnum, groupnum, subgrp) in ",
            "<foreach item='item' index='index' collection='benzImageDTOS' open='(' separator=',' close=')' >",
            "(#{item.catnum}, #{item.groupnum}, #{item.subgrp})",
            "</foreach>",
            "</script>"})
    List<BenzEPCPartsInfoDTO> queryPartsCodeByImageCode(@Param("benzImageDTOS") Collection<BenzImageDTO> benzImageDTOS);
}
